﻿@using System.Globalization;
@using MobileTrack.Core;
@using MobileTrack.Web;

@if (this.Request.IsAuthenticated)
{
    var role = Roles.Provider.GetRoleForUser(this.User.Identity.Name);
    var sucursalRole = Roles.Provider.GetSucursalRoleForUser(this.User.Identity.Name);
        
    if (!string.IsNullOrWhiteSpace(sucursalRole))
    {
        role = string.Format(CultureInfo.InvariantCulture, "{0} - {1}", role, sucursalRole);
    }
    <p>
        @this.Html.ActionLink(this.User.Identity.Name, "ChangePassword", "Account", routeValues: null, htmlAttributes: new { @class = "username", title = "Cambiar contraseña" }) (@role)
        @this.Html.ActionLink("Cerrar Sesión", "LogOff", "Account")
    </p>
}
else
{
    <ul>
        <li>@this.Html.ActionLink("Iniciar Sesión", "Login", "Account", routeValues: null, htmlAttributes: new { id = "loginLink" })</li>
    </ul>
}